The Galaga++ project was a school group project.  The group consisted of eight programmers, tasked with creating an altered form of the classic game "Galaga" using C++ on a custom, group developed engine.  I have pasted some code below from one of the classes I wrote in collaboration with another member of the team, which displays the game's credits:
 

//--------------------------------------------------------------------------------------------------------------------------------
// Method: init( const DxApp& app )
//
// Purpose: Initialize credits; set up scroll speed, delay, sound device, and other essentials for loading credits.
//--------------------------------------------------------------------------------------------------------------------------------
bool Credits::init ( const DxApp& app )
{
   bool result = true;
   donePlaying = false;
   timer = 0;
   string fileName; 
   scrollSpeed = 0;
   charScroll = -1.5;
   initDelay = 0;
   charIndex = 0;
   winHeight = app.dxWinHeight();
   winWidth = app.dxWinWidth();
   
   assert( app.dxDev() != NULL );
   mySprite = app.dxSprite();
   assert( mySprite );
   mySprite->AddRef();
   
   AssetManager::instance().init();
   DxAssetLocator::instance().init();
   //Initialize sound module
   mySoundDevice = GameSound::buildSoundObj( 0 ); 
   mySoundDevice->init();
   myStartGameMusic = mySoundDevice->loadSound( "FortuneDays.mp3" ); 
   mySoundDevice->startSFX( myStartGameMusic ); 
   
   myStarfield.load( app.dxDev(), DxAssetLocator::instance().getArtworkPath( "Starfield.bmp" ), 800, 600, 1, 1 );
   myStarfield.setPosition( 0, 0 );
   
   mySecondStarfield.load( app.dxDev(), DxAssetLocator::instance().getArtworkPath( "Starfield.bmp" ), 800, 600, 1, 1 );
   mySecondStarfield.setPosition( 0, -600 );
   myPlayField = CRECT( 0, 0, winWidth, winHeight );
   std::string filename = DxAssetLocator::instance().getConfigPath( "newSpriteSheetDescriptor.txt" );
   
   //SAS: This and its ilk likely near to the 1st thing to occur in gameInit
   bool assetsLoaded = AssetManager::instance().loadAssetDescriptions( filename.c_str(), app.dxDev() );
   if( assetsLoaded )
   {
      characters[0].loadAsset( "ebbg" );
      characters[0].setPosition( ((winWidth/2) - (characters[0].getFrameWidth()/2)), (myPlayField.bottom + 100) );
      characters[13].loadAsset( "novi" );         
      characters[13].setPosition( ((winWidth/2) - (characters[13].getFrameWidth()/2)), (myPlayField.bottom + 100) );
      characters[12].loadAsset( "alamo" );
      characters[12].setPosition( ((winWidth/2) - (characters[12].getFrameWidth()/2)), (myPlayField.bottom + 100) );
      characters[14].loadAsset( "logo" );         
      characters[14].setPosition( ((winWidth/2) - (characters[14].getFrameWidth()/2)), (myPlayField.bottom + 100) );
      characters[11].loadAsset( "scott" );
      characters[11].setPosition( ((winWidth/2) - (characters[11].getFrameWidth()/2)), (myPlayField.bottom + 100) );
      characters[9].loadAsset( "music" );         
      characters[9].setPosition( ((winWidth/2) - (characters[9].getFrameWidth()/2)), (myPlayField.bottom + 100) );
      characters[10].loadAsset( "thanks" );         
      characters[10].setPosition( ((winWidth/2) - (characters[10].getFrameWidth()/2)), (myPlayField.bottom + 100) );
      characters[1].loadAsset( "mike" );
      characters[1].setPosition( 0, (myPlayField.bottom + 100) );
      characters[2].loadAsset( "drew" );
      characters[2].setPosition( 0, (myPlayField.bottom + 100) );
      characters[3].loadAsset( "alex" );
      characters[3].setPosition( 0, (myPlayField.bottom + 100) );
      characters[4].loadAsset( "kris" );
      characters[4].setPosition( 0, (myPlayField.bottom + 100) );
      characters[5].loadAsset( "jon" );
      characters[5].setPosition( 0, (myPlayField.bottom + 100) );
      characters[6].loadAsset( "nick" );
      characters[6].setPosition( 0, (myPlayField.bottom + 100) );
      characters[7].loadAsset( "kyle" );
      characters[7].setPosition( 0, (myPlayField.bottom + 100) );
      characters[8].loadAsset( "matt" );
      characters[8].setPosition( 0, (myPlayField.bottom + 100) );
   }
   else
   {
      result = false;
   }
   return result;
}
//--------------------------------------------------------------------------------------------------------------------------------
// Method: update()
//
// Purpose: Updates credits as they run; scrolls the background, plays music, reaches different delays.
//--------------------------------------------------------------------------------------------------------------------------------
bool Credits::update()
{
   mySoundDevice->update(); 
   myStarfield.update();
   mySecondStarfield.update();
   for ( int index = 0; index < NUM_CHARACTERS; index++ )
   {
      characters[index].update();
   }
   scrollBackground(1);
   if( characters[NUM_CHARACTERS - 1].getYPos() < ((winHeight/2) - (characters[NUM_CHARACTERS - 1].getFrameHeight()/2)) )
   {
      characters[NUM_CHARACTERS - 1].setVelocity( 0, 0 );
   }
   if( Utilities::timerReachedDelay( timer, scrollDelay() ) && initDelay > 0 )
   {
      if ( charIndex < (NUM_CHARACTERS - 6 ) )
      {
         characters[charIndex].setPosition( 0, -2000 );
         if ( charIndex == (NUM_CHARACTERS - 7) )
         {
            characters[charIndex + 1].setVelocity( 0, charScroll );
            charIndex++;
         }
      }
      else if ( charIndex < (NUM_CHARACTERS ) && charIndex != (NUM_CHARACTERS - 6 ) )
      {
         characters[charIndex].setVelocity( 0, charScroll );
      }
      charIndex++;
      if( charIndex == NUM_CHARACTERS + 4 )
         donePlaying = true;
   }
   else if( charIndex <= NUM_CHARACTERS - 1 )
   {
      if ( charIndex < (NUM_CHARACTERS - 6 ) )
      {
         characters[charIndex].setPosition( ((winWidth/2) - (characters[charIndex].getFrameWidth()/2)), ((winHeight/2) - (characters[charIndex].getFrameHeight()/2)) );
      }
   }
   initDelay++;
   return true;
}
//--------------------------------------------------------------------------------------------------------------------------------
// Method: run()
//
// Purpose: Runs Credits; draws loaded sprites  & starfield.
//--------------------------------------------------------------------------------------------------------------------------------
bool Credits::run( )
{
   myStarfield.draw( mySprite );
   mySecondStarfield.draw( mySprite );
   
   for ( int index = 0; index < NUM_CHARACTERS; index++ )
   {
      characters[index].draw( mySprite );
   }
   return true;
}
//--------------------------------------------------------------------------------------------------------------------------------
// Method: shutdown( )
//
// Purpose: Shuts down Credits; Sets velocity to images to 0, releases sprite and shuts down the Sound Device object.
//--------------------------------------------------------------------------------------------------------------------------------
bool Credits::shutdown ( )
{
   for(int x = 0; x < NUM_CHARACTERS; x++)
   {
      characters[x].setVelocity(0, 0);
   }
   if ( mySprite )
   {
      mySprite->Release();
      mySprite = NULL;
   }
   if(mySoundDevice)
   {
      mySoundDevice->shutDown(); 
      delete mySoundDevice;
      mySoundDevice = NULL;
   }
   return true;
}
//--------------------------------------------------------------------------------------------------------------------------------
// Method: scrollBackground( float speed )
//
// Purpose: Method created to aid in scrolling the background in the credits.
//--------------------------------------------------------------------------------------------------------------------------------
void Credits::scrollBackground( float speed )
{
   scrollSpeed += speed;
   if(scrollSpeed >= 1)
   {
      scrollSpeed -= 1;
      myStarfield.setPosition((int)myStarfield.getXPos(), (int)myStarfield.getYPos() + 1);
      mySecondStarfield.setPosition((int)mySecondStarfield.getXPos(), (int)mySecondStarfield.getYPos() + 1);
      if(myStarfield.getYPos() > winHeight)
      {
         myStarfield.setPosition((int)myStarfield.getXPos(), 0);
         mySecondStarfield.setPosition((int)mySecondStarfield.getXPos(), (int)-myStarfield.getFrameHeight());
      }
   }
}
 
Galaga++ Project
Published:

Galaga++ Project

A Galaga clone/remake game created as a school project.

Published: